package com.group.project.hrms.service.impl;

import com.group.project.hrms.entity.AttendanceMonthlyReport;
import com.group.project.hrms.mapper.AttendanceMonthlyReportMapper;
import com.group.project.hrms.service.IAttendanceMonthlyReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class AttendanceMonthlyReportService implements IAttendanceMonthlyReportService {

    @Autowired
    private AttendanceMonthlyReportMapper attendanceMonthlyReportMapper;


    @Override
    public int insertAttendanceMonthlyReport(AttendanceMonthlyReport attendanceMonthlyReport) {
        return attendanceMonthlyReportMapper.insert(attendanceMonthlyReport);
    }

    @Override
    public int deleteAttendanceMonthlyReport(AttendanceMonthlyReport attendanceMonthlyReport) {
        return attendanceMonthlyReportMapper.deleteByPrimaryKey(attendanceMonthlyReport);
    }

    @Override
    public int updateAttendanceMonthlyReport(AttendanceMonthlyReport attendanceMonthlyReport) {
        return 0;
    }

    @Override
    public AttendanceMonthlyReport selectAttendanceMonthlyReport(AttendanceMonthlyReport attendanceMonthlyReport) {
        return null;
    }

    @Override
    public List<AttendanceMonthlyReport> selectAttendanceMonthlyReportByArchiveMonth(String month) {
        Example example = new Example(AttendanceMonthlyReport.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.orEqualTo("fileMonth", month);
        return attendanceMonthlyReportMapper.selectByExample(example);
    }

    @Override
    public List<AttendanceMonthlyReport> selectAllAttendanceMonthlyReport() {
        return attendanceMonthlyReportMapper.selectAll();
    }
}
